package cn.com.cifi.mars.constant;

import lombok.Data;

import java.util.ArrayList;
import java.util.List;

/**
 * @Author: ztz
 * @Date: 2020/12/10 14:33
 *
 * 标准业态对应三业态表
 */

public enum StandardFormatsMapEnum {
    /**
     * 三大业态
     *RESIDENce("101", "住宅"),
     *OTHER("105", "其他"),
     *BUSINESS_VILLA_list("102", "商业"),
     *PARKING("103", "车位");
     *
     */

    //商墅
    BUSINESS_VILLA("104", "102"),
    //酒店
    HOTEL("135", "102"),
    //LOFT
    LOFT("044", "102"),
    //车位
    PARKING_SPACE("139", "103"),
    //酒店式公寓
    SOHO("100", "102"),
    //独栋办公
    SINGLE_FAMILY_OFFICE("108", "102"),
    //标准办公
    STANDARD_OFFICE("059", "102"),
    //地下储藏室/非机动车库
    UNDERGROUND_STORAGE_ROOM_NON_MOTORIZED_GARAGE("146", "105"),
    //配套
    ANCILLARY_FACILITY("132", "105"),
    //商业
    BUSINESS("053", "102"),
    //其他
    OTHER("089", "105"),
    //住宅
    RESIDENTIAL("013", "101");
    private String key;
    private String value;

    StandardFormatsMapEnum(String key, String value) {
        this.key = key;
        this.value = value;
    }
    //根据标准业态编码获取大业态编码
    public static String getValueByKey(String key){
        for(StandardFormatsMapEnum e:StandardFormatsMapEnum.values()){
            if(key.equals(e.getKey())){
                return e.getValue();
            }
        }
        return  null;
    }
    //根据大业态编码获取标准业态集合
    public static List<String> getKeyByValue(String value){
        List<String> typeList = new ArrayList<>();
        for(StandardFormatsMapEnum e:StandardFormatsMapEnum.values()){
            if(value.equals(e.getValue())){
                typeList.add(e.getKey());
            }
        }
        return  typeList;
    }

    public static List<String> getSortStandardFormatsCodeList(){
        List<String> codeList = new ArrayList<>();
        for (BigStandardFormatsEnum bigStandardFormatsEnum : BigStandardFormatsEnum.values()){
            codeList.add(bigStandardFormatsEnum.getKey());
            List<String> codes = StandardFormatsMapEnum.getKeyByValue(bigStandardFormatsEnum.getKey());
            codeList.addAll(codes);
        }
        return codeList;
    }


    public String getKey() {
        return key;
    }

    public String getValue() {
        return value;
    }


}
